/*
 * @Author: C.
 * @Date: 2023-06-13 16:51:01
 */
import { genFiles, baseWorkDir } from './genfile';
export function genMoudle(module: string, dir: string, moduleKey) {
  const menuItem = {
    name: moduleKey,
    title: moduleKey,
  };

  const targetDir = baseWorkDir + dir;
  if (module && dir && moduleKey) {
    switch (module) {
      case 'module':
        genFiles(menuItem, targetDir, 'main');
        genFiles(menuItem, targetDir, 'detail');
        genFiles(menuItem, targetDir, 'edit');
        break;
      case 'main':
        genFiles(menuItem, targetDir, 'main');
        break;
      case 'detail':
        genFiles(menuItem, targetDir, 'detail');
        break;
      case 'edit':
        genFiles(menuItem, targetDir, 'edit');
        break;

      default:
        break;
    }
    console.log('✨ - build successfully!');
  } else {
    throw Error('A necessary parameter is missing');
  }
}
